home *** CD-ROM | disk | FTP | other *** search
Text File | 2003-07-17 | 83.7 KB | 2,854 lines |
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: 26 Feb 1996
- //
- // Description:
- // This procedure creates the status line.
- //
- // Input Arguments:
- // The parent control that the status line will be created in.
- //
- // Return Value:
- // The name of the top layout created.
- // Used for embedding the status line within another layout.
- //
-
- ////////////////////////////////////////////////////////////////
- // Expand/collapse procedures section
- ///////////////////////////////////////////////////////////////
-
- global proc toggleFileIcons (int $arg)
- //
- // Show and Hide the file icons
- // $arg=1 means show, 0 means hide, -1 means use optionVar
- //
- {
- global string $gStatusLine;
- setParent $gStatusLine;
-
- int $state = $arg;
- if ($state < 0) $state = (!`optionVar -q showStatusFiles`);
-
- int $edging = 2;
- if ($state) {
- iconTextButton -edit -manage true newSceneButton;
- iconTextButton -edit -manage true openSceneButton;
- iconTextButton -edit -manage true saveSceneButton;
- formLayout -e
- -ac selectionSetCollapse left $edging saveSceneButton
- $gStatusLine;
-
- iconTextButton -edit -i1 openBar.xpm fileCollapse;
- } else {
- iconTextButton -edit -manage false newSceneButton;
- iconTextButton -edit -manage false openSceneButton;
- iconTextButton -edit -manage false saveSceneButton;
- formLayout -e
- -ac selectionSetCollapse left $edging fileCollapse
- $gStatusLine;
-
- iconTextButton -edit -i1 closeBar.xpm fileCollapse;
- }
- optionVar -intValue "showStatusFiles" $state;
- }
-
- global proc toggleSnapIcons (int $arg)
- //
- // Show and Hide the snapping icons
- // $arg=1 means show, 0 means hide, -1 means use optionVar
- //
- {
- global string $gStatusLine;
- setParent $gStatusLine;
-
- int $state = $arg;
- if ($state < 0) $state = (!`optionVar -q showStatusSnap`);
-
- int $edging = 2;
- if ($state) {
- formLayout -edit -manage true snapIcons;
- formLayout -e
- -ac historyCollapse left $edging snapIcons
- $gStatusLine;
-
- iconTextButton -edit -i1 openBar.xpm snapCollapse;
- } else {
- formLayout -edit -manage false snapIcons;
- formLayout -e
- -ac historyCollapse left $edging snapCollapse
- $gStatusLine;
-
- iconTextButton -edit -i1 closeBar.xpm snapCollapse;
- }
- optionVar -intValue "showStatusSnap" $state;
- }
-
- global proc toggleRenderIcons (int $arg)
- //
- // Show and Hide the rendering icons
- // $arg=1 means show, 0 means hide, -1 means use optionVar
- //
- {
- global string $gStatusLine;
- setParent $gStatusLine;
-
- int $state = $arg;
- if ($state < 0) $state = (!`optionVar -q showStatusRender`);
-
- int $edging = 2;
- if ($state) {
- iconTextButton -edit -manage true renderButton;
- iconTextButton -edit -manage true iprRenderButton;
- iconTextButton -edit -manage true renderGlobalsButton;
- formLayout -e
- -ac inputFieldCollapse left $edging renderGlobalsButton
- $gStatusLine;
-
- iconTextButton -edit -i1 openBar.xpm renderCollapse;
-
- } else {
- iconTextButton -edit -manage false renderButton;
- iconTextButton -edit -manage false iprRenderButton;
- iconTextButton -edit -manage false renderGlobalsButton;
- formLayout -e
- -ac inputFieldCollapse left $edging renderCollapse
- $gStatusLine;
- iconTextButton -edit -i1 closeBar.xpm renderCollapse;
- }
- optionVar -intValue "showStatusRender" $state;
- }
-
- global proc toggleInputField (int $arg)
- //
- // Show and Hide the input field
- // $arg=1 means show, 0 means hide, -1 means use optionVar
- //
- {
- global string $gNumericalInputField;
- global string $gStatusLine;
- setParent $gStatusLine;
-
- int $state = $arg;
- if ($state < 0) $state = (!`optionVar -q showStatusInputField`);
-
- int $edging = 2;
- if ($state) {
- iconTextButton -edit -manage true statusFieldButton;
- textField -edit -manage true $gNumericalInputField;
- iconTextButton -edit -i1 openBar.xpm inputFieldCollapse;
-
- } else {
- iconTextButton -edit -manage false statusFieldButton;
- textField -edit -manage false $gNumericalInputField;
- iconTextButton -edit -i1 closeBar.xpm inputFieldCollapse;
- }
- optionVar -intValue "showStatusInputField" $state;
- }
-
- global proc toggleHistoryIcons (int $arg)
- //
- // Show and Hide the history icons
- // $arg=1 means show, 0 means hide, -1 means use optionVar
- //
- {
- global string $gStatusLine;
- setParent $gStatusLine;
-
- int $state = $arg;
- if ($state < 0) $state = (!`optionVar -q showStatusHistory`);
-
- int $edging = 2;
- if ($state) {
- formLayout -edit -manage true historyLayout;
- formLayout -e
- -ac renderCollapse left $edging historyLayout
- $gStatusLine;
-
- iconTextButton -edit -i1 openBar.xpm historyCollapse;
-
- } else {
- formLayout -edit -manage false historyLayout;
- formLayout -e
- -ac renderCollapse left $edging historyCollapse
- $gStatusLine;
- iconTextButton -edit -i1 closeBar.xpm historyCollapse;
- }
- optionVar -intValue "showStatusHistory" $state;
- }
-
- global proc toggleSelectionSetIcons (int $arg)
- //
- // Show and Hide the selection set icons
- // $arg=1 means show, 0 means hide, -1 means use optionVar
- //
- {
- global string $gStatusLine;
- setParent $gStatusLine;
-
- int $state = $arg;
- if ($state < 0) $state = (!`optionVar -q showStatusSelectionSet`);
-
- int $edging = 2;
- if ($state) {
- formLayout -edit -manage true presetForm;
- formLayout -e
- -ac selectModeCollapse left $edging presetForm
- $gStatusLine;
-
- iconTextButton -edit -i1 openBar.xpm selectionSetCollapse;
- } else {
- formLayout -edit -manage false presetForm;
- formLayout -e
- -ac selectModeCollapse left $edging selectionSetCollapse
- $gStatusLine;
-
- iconTextButton -edit -i1 closeBar.xpm selectionSetCollapse;
- }
- optionVar -intValue "showStatusSelectionSet" $state;
- }
-
- global proc toggleSelectModeIcons (int $arg)
- //
- // Show and Hide the select mode icons
- // $arg=1 means show, 0 means hide, -1 means use optionVar
- //
- {
- global string $gStatusLine;
- setParent $gStatusLine;
-
- int $state = $arg;
- if ($state < 0) $state = (!`optionVar -q showStatusSelectMode`);
-
- int $edging = 2;
- if ($state) {
- formLayout -edit -manage true masksForm;
- formLayout -e
- -ac selectMasksCollapse left $edging masksForm
- $gStatusLine;
-
- iconTextButton -edit -i1 openBar.xpm selectModeCollapse;
- } else {
- formLayout -edit -manage false masksForm;
-
- formLayout -e
- -ac selectMasksCollapse left $edging selectModeCollapse
- $gStatusLine;
-
- iconTextButton -edit -i1 closeBar.xpm selectModeCollapse;
- }
- optionVar -intValue "showStatusSelectMode" $state;
- }
-
- global proc toggleSelectMaskIcons (int $arg)
- //
- // Show and Hide the select options icons
- // $arg=1 means show, 0 means hide, -1 means use optionVar
- //
- {
- global string $gStatusLine;
- setParent $gStatusLine;
-
- int $state = $arg;
- if ($state < 0) $state = (!`optionVar -q showStatusSelectMasks`);
-
- int $edging = 2;
- if ($state) {
- formLayout -edit -manage true selectMaskForm;
- iconTextCheckBox -edit -manage true lockSelectionIcon;
- iconTextCheckBox -edit -manage true highlightSelectIcon;
-
- formLayout -e
- -ac snapCollapse left $edging highlightSelectIcon
- $gStatusLine;
-
- iconTextButton -edit -i1 openBar.xpm selectMasksCollapse;
- } else {
- formLayout -edit -manage false selectMaskForm;
- iconTextCheckBox -edit -manage false lockSelectionIcon;
- iconTextCheckBox -edit -manage false highlightSelectIcon;
-
- formLayout -e
- -ac snapCollapse left $edging selectMasksCollapse
- $gStatusLine;
-
- iconTextButton -edit -i1 closeBar.xpm selectMasksCollapse;
- }
- optionVar -intValue "showStatusSelectMasks" $state;
- }
-
- ////////////////////////////////////////////////////////////////
- // Update procedures section
- ///////////////////////////////////////////////////////////////
-
- global proc updateLockSelectionIcon( )
- //
- // Toggles the state of the locked selection icon,
- // and the state of -xformNoSelect
- {
- if( `selectPref -q -xformNoSelect` == 0)
- {
- selectPref -xformNoSelect 1;
- iconTextCheckBox -e
- -v 1
- -ann "Unlock current selection"
- lockSelectionIcon;
- } else {
- selectPref -xformNoSelect 0;
- iconTextCheckBox -e
- -v 0
- -ann "Lock current selection"
- lockSelectionIcon;
- }
- }
-
-
- global proc toggleHighlightSelectIcon()
- {
- int $newState = !`selectPref -q -allowHiliteSelection`;
- selectPref -allowHiliteSelection $newState;
- updateHighlightSelectIcon;
- }
-
- global proc updateHighlightSelectIcon()
- {
- int $currentState = `selectPref -q -allowHiliteSelection`;
-
- if ($currentState == 0) {
- // Highlight select is off, so push the button in
- iconTextCheckBox -e -v 1
- -ann "Highlight Selection mode is off (Affects component selection mode)"
- -i1 "highlightSelectOff.xpm"
- highlightSelectIcon;
- } else {
- // Highlight select is on, so push the button out
- iconTextCheckBox -e -v 0
- -ann "Highlight Selection mode is on"
- -i1 "highlightSelectOn.xpm"
- highlightSelectIcon;
- }
- }
-
- // Adds a close button to a window.
- //
- global proc addCloseButton( string $windowName, string $formLayout, string $tabLayout )
- {
- setParent $formLayout;
-
- // Create the close button
- //
- string $attach = `separator -style "in"`;
- button -width 80 -label "Close" -align "center" closeButton;
- button -edit -command ("deleteUI -window " + $windowName) closeButton;
-
- // Align it to the form properly
- //
- formLayout -edit
- -attachForm $tabLayout "top" 0
- -attachForm $tabLayout "left" 5
- -attachForm $tabLayout "right" 5
- -attachControl $tabLayout "bottom" 5 $attach
-
- -attachControl $attach "bottom" 5 closeButton
- -attachForm $attach "left" 5
- -attachForm $attach "right" 5
- -attachNone $attach "top"
-
- -attachForm closeButton "bottom" 5
- -attachNone closeButton "top"
- -attachNone closeButton "left"
- -attachPosition closeButton "right" 3 62
- $formLayout;
-
- }
-
-
- global proc setEditMode( )
- //
- // Sets the edit mode when the tabs on the selection mask window
- // are clicked on.
- {
- string $currentTab = `tabLayout -q -st maskTabContainer`;
- if( $currentTab == "objMaskFrame" )
- {
- setSelectMode("objects", "Objects");
- }
- else {
- setSelectMode("components", "Components");
- }
- }
-
- global proc changeSelectMode( string $mode )
- {
- switch( $mode ) {
- case "-hierarchical":
- iconTextCheckBox -e -v 1 selectButton1;
- iconTextCheckBox -e -v 0 selectButton2;
- iconTextCheckBox -e -v 0 selectButton3;
- setSelectMode("hierarchy", "Hierarchy");
- break;
- case "-object":
- iconTextCheckBox -e -v 0 selectButton1;
- iconTextCheckBox -e -v 1 selectButton2;
- iconTextCheckBox -e -v 0 selectButton3;
- setSelectMode("objects", "Objects");
- break;
- case "-component":
- iconTextCheckBox -e -v 0 selectButton1;
- iconTextCheckBox -e -v 0 selectButton2;
- iconTextCheckBox -e -v 1 selectButton3;
- setSelectMode("components", "Components");
- break;
- }
-
- }
-
- global proc setHierSelectMode( string $mode )
- {
- if ( ! `selectMode -q $mode` ) {
- selectMode $mode;
- }
- else {
- switch( $mode ) {
- case "-root":
- iconTextCheckBox -e -v 1 hierRootButton;
- break;
- case "-leaf":
- iconTextCheckBox -e -v 1 hierLeafButton;
- break;
- case "-template":
- iconTextCheckBox -e -v 1 hierTemplateButton;
- break;
- // case "-preset":
- // iconTextCheckBox -e -v 1 comboModelingButton;
- }
- }
- }
-
-
- global proc updateSelectionIcons( string $selectMode )
- //
- // Handles updating the selection mode icons in the
- // status line.
- {
- switch( $selectMode ) {
- case "-byHierarchy":
-
- int $isRoot = `selectMode -q -root`;
- int $isLeaf = `selectMode -q -leaf`;
- int $isTemplate = `selectMode -q -template`;
- // int $isBranch = `selectMode -q -branch`;
- // iconTextCheckBox -e -v $isBranch hierBranchButton;
- iconTextCheckBox -e -v $isRoot hierRootButton;
- iconTextCheckBox -e -v $isLeaf hierLeafButton;
- iconTextCheckBox -e -v $isTemplate hierTemplateButton;
-
- // Make sure that only the select by
- // hierarchy button is on.
- //
- iconTextCheckBox -e -v 1 selectButton1;
- iconTextCheckBox -e -v 0 selectButton2;
- iconTextCheckBox -e -v 0 selectButton3;
-
- formLayout -e -manage 1 hierarchyIcons;
- formLayout -e -manage 0 objectMaskIcons;
- formLayout -e -manage 0 componentMaskIcons;
- text -e -manage 0 comboSelectText;
- // textField -e -tx "Hierarchy" maskField;
-
- break;
-
- case "-byObjectType":
-
- // Make sure that the select by object type
- // button only is on.
- //
- iconTextCheckBox -e -v 0 selectButton1;
- iconTextCheckBox -e -v 1 selectButton2;
- iconTextCheckBox -e -v 0 selectButton3;
-
- //
- // Flip the visibility of the object
- // and component mask icons
- //
- formLayout -e -manage 0 hierarchyIcons;
- formLayout -e -manage 1 objectMaskIcons;
- formLayout -e -manage 0 componentMaskIcons;
- text -e -manage 0 comboSelectText;
- // textField -e -tx "Objects" maskField;
-
- break;
-
- case "-byCompType":
-
- // Make sure that the select by component
- // type button is the only one on.
- iconTextCheckBox -e -v 0 selectButton1;
- iconTextCheckBox -e -v 0 selectButton2;
- iconTextCheckBox -e -v 1 selectButton3;
-
- //
- // Flip the visibility of the object
- // and component mask icons
- //
- formLayout -e -manage 0 hierarchyIcons;
- formLayout -e -manage 0 objectMaskIcons;
- formLayout -e -manage 1 componentMaskIcons;
- text -e -manage 0 comboSelectText;
- // textField -e -tx "Components" maskField;
-
- break;
-
- case "-byPreset":
-
- // Make sure that the select by hierarchy
- // type button is the only one on.
- iconTextCheckBox -e -v 0 selectButton1;
- iconTextCheckBox -e -v 1 selectButton2;
- iconTextCheckBox -e -v 1 selectButton3;
-
- //
- // Flip the visibility of the object
- // and component mask icons
- //
- formLayout -e -manage 0 hierarchyIcons;
- formLayout -e -manage 0 objectMaskIcons;
- formLayout -e -manage 0 componentMaskIcons;
- text -e -manage 1 comboSelectText;
- // textField -e -tx "Mixed" maskField;
-
- break;
- }
- }
-
- global proc updateSelectionModeIcons()
- // This routine is called by a script job when the selection mode changes
- {
- if ( `selectMode -q -object` ) {
- updateSelectionIcons -byObjectType;
- }
- else if ( `selectMode -q -component` ) {
- updateSelectionIcons -byCompType;
- }
- else if ( `selectMode -q -hierarchical` ) {
- updateSelectionIcons -byHierarchy;
- }
- else if ( `selectMode -q -preset` ) {
- updateSelectionIcons -byPreset;
- }
-
- string $selectionMode = `getSelectMode`;
- textField -e -tx $selectionMode maskField;
- }
-
- global proc updateObjectSelectionMasks( )
- //
- // Handles updating of ALL object selection icons
- // in the toolbar.
- {
- // Update the selection mask icons on the toolbar-
- // if any item in the mask is picked, change the
- // icon to signify that something in that mask is
- // selected - if nothing is picked, turn it
- // off. If all items are picked, then turn
- // the icon on, and make sure the correct icon
- // is displayed.
-
- // Markers
- //
- int $maskResult = ( `selectType -q -handle` +
- `selectType -q -ikHandle` );
-
- switch( $maskResult ) {
- case 0:
- // they're all off - turn off the icon, and
- // set the correct icon
- //
- iconTextCheckBox -e -v 0 objButton1;
- iconTextCheckBox -e -i1 "pickHandlesObj.xpm" objButton1;
- break;
- case 2:
- // they're all on - turn the icon on, and
- // set the correct icon
- //
- iconTextCheckBox -e -v 1 objButton1;
- iconTextCheckBox -e -i1 "pickHandlesObj.xpm" objButton1;
- break;
- default:
- // something is on - make sure the icon is
- // on, and set the correct icon
- //
- iconTextCheckBox -e -v 1 objButton1;
- iconTextCheckBox -e -i1 "pickHandlesObjPartial.xpm" objButton1;
- break;
- }
-
- // Joint
- //
- iconTextCheckBox -e -v `selectType -q -joint` objButton2;
-
- // Curves
- //
- int $fullMaskCount = 1;
- $maskResult = `selectType -q -nurbsCurve`;
-
- if (`isTrue MayaCreatorExists` && (`licenseCheck -m "edit" -typ "particlePaint"`)) {
- $maskResult += `selectType -q -stroke`;
- $fullMaskCount ++;
- }
- if( `isTrue "SurfaceUIExists"` ) {
- $maskResult += `selectType -q -cos`;
- $fullMaskCount ++;
- }
-
- if( 0 == $maskResult ) {
- // they're all off - turn off the icon, and
- // set the correct icon
- //
- iconTextCheckBox -e -v 0 objButton3;
- iconTextCheckBox -e -i1 "pickCurveObj.xpm" objButton3;
- }
- else if( $fullMaskCount == $maskResult ) {
- // they're all on - turn the icon on, and
- // set the correct icon
- //
- iconTextCheckBox -e -v 1 objButton3;
- iconTextCheckBox -e -i1 "pickCurveObj.xpm" objButton3;
- }
- else {
- // something is on - make sure the icon is
- // on, and set the correct icon
- //
- iconTextCheckBox -e -v 1 objButton3;
- iconTextCheckBox -e -i1 "pickCurveObjPartial.xpm" objButton3;
- }
-
- // Surfaces
- //
- $maskResult = ( `selectType -q -polymesh` +
- `selectType -q -plane` );
-
- $fullMaskCount = 2;
-
- if ( `isTrue "SurfaceUIExists"` ) {
- $maskResult += `selectType -q -nurbsSurface`;
- $fullMaskCount++;
- }
- if (`isTrue "SubdivUIExists"`) {
- $maskResult += `selectType -q -subdiv`;
- $fullMaskCount++;
- }
-
- if ( $maskResult == 0 ) {
- // they're all off - turn off the icon, and
- // set the correct icon
- //
- iconTextCheckBox -e -v 0 objButton4;
- iconTextCheckBox -e -i1 "pickGeometryObj.xpm" objButton4;
- }
- else if ( $maskResult == $fullMaskCount ) {
- // they're all on - turn the icon on, and
- // set the correct icon
- //
- iconTextCheckBox -e -v 1 objButton4;
- iconTextCheckBox -e -i1 "pickGeometryObj.xpm" objButton4;
- }
- else {
- // something is on - make sure the icon is
- // on, and set the correct icon
- //
- iconTextCheckBox -e -v 1 objButton4;
- iconTextCheckBox -e -i1 "pickGeometryObjPartial.xpm" objButton4;
- }
-
- // Deformations
- //
- $maskResult = ( `selectType -q -lattice` +
- `selectType -q -cluster` +
- `selectType -q -sculpt` +
- `selectType -q -nonlinear` );
-
- switch( $maskResult ) {
- case 0:
- // they're all off - turn off the icon, and
- // set the correct icon
- //
- iconTextCheckBox -e -v 0 objButton5;
- iconTextCheckBox -e -i1 "pickDeformerObj.xpm" objButton5;
- break;
- case 4:
- // they're all on - turn the icon on, and
- // set the correct icon
- //
- iconTextCheckBox -e -v 1 objButton5;
- iconTextCheckBox -e -i1 "pickDeformerObj.xpm" objButton5;
- break;
- default:
- // something is on - make sure the icon is
- // on, and set the correct icon
- //
- iconTextCheckBox -e -v 1 objButton5;
- iconTextCheckBox -e -i1 "pickDeformerObjPartial.xpm" objButton5;
- break;
- }
-
- // Dynamics
- //
- // If the user is licensed to use dynamics, set the icons
- // accordingly, otherwise turn them off.
- //
- int $isFluids = fluidEditLicenseFound();
- int $isComplete = `licenseCheck -m edit -type complete`;
-
- if( $isFluids || $isComplete ) {
- int $allOn = false;
-
- if( $isFluids ) {
- $maskResult = ( `selectType -q -particleShape` +
- `selectType -q -emitter` +
- `selectType -q -field` +
- `selectType -q -fluid` +
- `selectType -q -spring` +
- `selectType -q -rigidBody` +
- `selectType -q -rigidConstraint` );
- $allOn = ($maskResult == 7);
- } else if( $isComplete ) {
- $maskResult = ( `selectType -q -particleShape` +
- `selectType -q -emitter` +
- `selectType -q -field` +
- `selectType -q -spring` +
- `selectType -q -rigidBody` +
- `selectType -q -rigidConstraint` );
- $allOn = ($maskResult == 6);
- }
-
- int $allOff = $maskResult == 0;
-
- // they're all off - turn off the icon, and
- // set the correct icon
- //
- if( $allOff ) {
- iconTextCheckBox -e -v 0 objButton6;
- iconTextCheckBox -e -i1 "pickDynamicsObj.xpm" objButton6;
- }
- // they're all on - turn the icon on, and
- // set the correct icon
- //
- else if( $allOn ) {
- iconTextCheckBox -e -v 1 objButton6;
- iconTextCheckBox -e -i1 "pickDynamicsObj.xpm" objButton6;
- }
- // something is on - make sure the icon is
- // on, and set the correct icon
- //
- else {
- iconTextCheckBox -e -v 1 objButton6;
- iconTextCheckBox -e -i1 "pickDynamicsObjPartial.xpm" objButton6;
-
- }
- }
- else
- {
- iconTextCheckBox -e -v 0 objButton6;
- iconTextCheckBox -e -i1 "pickDynamicsObj.xpm" objButton6;
- }
-
- // Rendering
- //
- $maskResult = ( `selectType -q -light` +
- `selectType -q -camera` +
- `selectType -q -texture` );
-
- switch( $maskResult ) {
- case 0:
- // they're all off - turn off the icon, and
- // set the correct icon
- //
- iconTextCheckBox -e -v 0 objButton7;
- iconTextCheckBox -e -i1 "pickRenderingObj.xpm" objButton7;
- break;
- case 3:
- // they're all on - turn the icon on, and
- // set the correct icon
- //
- iconTextCheckBox -e -v 1 objButton7;
- iconTextCheckBox -e -i1 "pickRenderingObj.xpm" objButton7;
- break;
- default:
- // something is on - make sure the icon is
- // on, and set the correct icon
- //
- iconTextCheckBox -e -v 1 objButton7;
- iconTextCheckBox -e -i1 "pickRenderingObjPartial.xpm" objButton7;
- break;
- }
-
- // Other
- //
- $maskResult = ( `selectType -q -ikEndEffector` +
- `selectType -q -locator` +
- `selectType -q -dimension` );
-
- switch( $maskResult ) {
- case 0:
- // they're all off - turn off the icon, and
- // set the correct icon
- //
- iconTextCheckBox -e -v 0 objButton8;
- iconTextCheckBox -e -i1 "pickOtherObj.xpm" objButton8;
- break;
- case 3:
- // they're all on - turn the icon on, and
- // set the correct icon
- //
- iconTextCheckBox -e -v 1 objButton8;
- iconTextCheckBox -e -i1 "pickOtherObj.xpm" objButton8;
- break;
- default:
- // something is on - make sure the icon is
- // on, and set the correct icon
- //
- iconTextCheckBox -e -v 1 objButton8;
- iconTextCheckBox -e -i1 "pickOtherObjPartial.xpm" objButton8;
- break;
- }
- string $selectionMode = `getSelectMode`;
- textField -e -tx $selectionMode maskField;
- }
-
-
- global proc updateComponentSelectionMasks( )
- //
- // Handles updating of ALL component selection icons
- // in the toolbar.
- {
- // Update the selection mask icons - if any
- // item in the mask is picked, change the icon
- // to signify that something in that mask is
- // selected - if nothing is picked, turn it
- // off. If all items are picked, then turn
- // the icon on, and make sure the correct icon
- // is displayed.
-
- // Points
- //
- int $maskResult = ( `selectType -q -cv` +
- `selectType -q -polymeshVertex` +
- `selectType -q -latticePoint` +
- `selectType -q -particle`);
-
- int $fullMaskCount = 4;
-
- if( `isTrue "SubdivUIExists"` ) {
- $maskResult += `selectType -q -subdivMeshPoint`;
- $fullMaskCount++;
- }
-
- if ( $maskResult == 0 ) {
- // they're all off - turn off the icon, and
- // set the correct icon
- //
- iconTextCheckBox -e -v 0 compButton1;
- iconTextCheckBox -e -i1 "pickPointComp2.xpm" compButton1;
- }
- else if ( $maskResult == $fullMaskCount ) {
- // they're all on - turn the icon on, and
- // set the correct icon
- //
- iconTextCheckBox -e -v 1 compButton1;
- iconTextCheckBox -e -i1 "pickPointComp2.xpm" compButton1;
- }
- else {
- // something is on - make sure the icon is
- // on, and set the correct icon
- //
- iconTextCheckBox -e -v 1 compButton1;
- iconTextCheckBox -e -i1 "pickPointComp2Partial.xpm" compButton1;
- }
-
- // Parm Points
- //
- $fullMaskCount = 4;
- int $maskResult = ( `selectType -q -editPoint` +
- `selectType -q -curveParameterPoint` +
- `selectType -q -surfaceParameterPoint` +
- `selectType -q -puv`);
-
- if( `isTrue "SubdivUIExists"` ) {
- $maskResult += `selectType -q -smu`;
- $fullMaskCount++;
- }
-
- if( $maskResult == 0 ) {
- // they're all off - turn off the icon, and
- // set the correct icon
- //
- iconTextCheckBox -e -v 0 compButton2;
- iconTextCheckBox -e -i1 "pickPointComp.xpm" compButton2;
- }
- else if ( $maskResult == $fullMaskCount ) {
- // they're all on - turn the icon on, and
- // set the correct icon
- //
- iconTextCheckBox -e -v 1 compButton2;
- iconTextCheckBox -e -i1 "pickPointComp.xpm" compButton2;
- }
- else {
- // something is on - make sure the icon is
- // on, and set the correct icon
- //
- iconTextCheckBox -e -v 1 compButton2;
- iconTextCheckBox -e -i1 "pickPointCompPartial.xpm" compButton2;
- }
-
- // Lines
- //
- $maskResult = ( `selectType -q -polymeshEdge` +
- `selectType -q -springComponent`);
-
- $fullMaskCount = 2;
- if ( `isTrue "SurfaceUIExists"` ) {
- $maskResult += `selectType -q -surfaceEdge`;
- $maskResult += `selectType -q -isoparm`;
- $fullMaskCount+=2;
- }
- if( `isTrue "SubdivUIExists"` ) {
- $maskResult += `selectType -q -subdivMeshEdge`;
- $fullMaskCount++;
- }
-
- if ( $maskResult == 0 ) {
- // they're all off - turn off the icon, and
- // set the correct icon
- //
- iconTextCheckBox -e -v 0 compButton3;
- iconTextCheckBox -e -i1 "pickLineComp.xpm" compButton3;
- }
- else if ( $maskResult == $fullMaskCount ) {
- // they're all on - turn the icon on, and
- // set the correct icon
- //
- iconTextCheckBox -e -v 1 compButton3;
- iconTextCheckBox -e -i1 "pickLineComp.xpm" compButton3;
- }
- else {
- // something is on - make sure the icon is
- // on, and set the correct icon
- //
- iconTextCheckBox -e -v 1 compButton3;
- iconTextCheckBox -e -i1 "pickLineCompPartial.xpm" compButton3;
- }
-
- // Faces
- //
- $maskResult = `selectType -q -facet` + `selectType -q -surfaceFace`;
- $fullMaskCount = 2;
-
- if( `isTrue "SubdivUIExists"` ) {
- $maskResult += `selectType -q -subdivMeshFace`;
- $fullMaskCount++;
- }
-
- if ( $maskResult == 0 ) {
- iconTextCheckBox -e -v 0 compButton4;
- iconTextCheckBox -e -i1 "pickFacetComp.xpm" compButton4;
- }
- else if ( $maskResult == $fullMaskCount ) {
- iconTextCheckBox -e -v 1 compButton4;
- iconTextCheckBox -e -i1 "pickFacetComp.xpm" compButton4;
- }
- else {
- iconTextCheckBox -e -v 1 compButton4;
- iconTextCheckBox -e -i1 "pickFacetCompPartial.xpm" compButton4;
- }
-
-
- // Hulls
- //
- iconTextCheckBox -e -v `selectType -q -hull` compButton5;
-
-
- // Pivots
- //
- $maskResult = ( `selectType -q -rotatePivot` +
- `selectType -q -scalePivot` +
- `selectType -q -jointPivot` );
-
- switch( $maskResult ) {
- case 0:
- // they're all off - turn off the icon, and
- // set the correct icon
- //
- iconTextCheckBox -e -v 0 compButton6;
- iconTextCheckBox -e -i1 "pickPivotComp.xpm" compButton6;
- break;
- case 3:
- // they're all on - turn the icon on, and
- // set the correct icon
- //
- iconTextCheckBox -e -v 1 compButton6;
- iconTextCheckBox -e -i1 "pickPivotComp.xpm" compButton6;
- break;
- default:
- // something is on - make sure the icon is
- // on, and set the correct icon
- //
- iconTextCheckBox -e -v 1 compButton6;
- iconTextCheckBox -e -i1 "pickPivotCompPartial.xpm" compButton6;
- break;
- }
-
-
- // Markers
- //
- iconTextCheckBox -e -v `selectType -q -selectHandle` compButton7;
-
-
- // Other
- //
- $maskResult = ( `selectType -q -imagePlane` +
- `selectType -q -localRotationAxis` );
-
- switch( $maskResult ) {
- case 0:
- // they're all off - turn off the icon, and
- // set the correct icon
- //
- iconTextCheckBox -e -v 0 compButton8;
- iconTextCheckBox -e -i1 "pickOtherComp.xpm" compButton8;
- break;
- case 2:
- // they're all on - turn the icon on, and
- // set the correct icon
- //
- iconTextCheckBox -e -v 1 compButton8;
- iconTextCheckBox -e -i1 "pickOtherComp.xpm" compButton8;
- break;
- default:
- // something is on - make sure the icon is
- // on, and set the correct icon
- //
- iconTextCheckBox -e -v 1 compButton8;
- iconTextCheckBox -e -i1 "pickOtherCompPartial.xpm" compButton8;
- break;
- }
- string $selectionMode = `getSelectMode`;
- textField -e -tx $selectionMode maskField;
- }
-
- global proc updateSnapMasks ()
- {
- iconTextCheckBox -e -v `snapMode -q -curve` snapButton1;
- iconTextCheckBox -e -v `snapMode -q -point` snapButton3;
- iconTextCheckBox -e -v `snapMode -q -grid` snapButton4;
- iconTextCheckBox -e -v `snapMode -q -viewPlane` snapButton6;
- }
-
- global proc updateConstructionHistory()
- {
- int $val = `constructionHistory -q -toggle`;
- iconTextCheckBox -e -v $val constructionHistoryButton;
- if( $val ) {
- iconTextCheckBox -e -i1 "constructionHistoryOn.xpm"
- constructionHistoryButton;
- }
- else {
- iconTextCheckBox -e -i1 "constructionHistoryOff.xpm"
- constructionHistoryButton;
- }
-
- }
-
- global proc createMaskPopup( string $selectionGrp )
- //
- // Creates popup menus on each of the icons in the
- // toolbar, so that users can specify portions of
- // the mask to turn on by selecting the item in
- // the popup menu. Deletes all items in the popup
- // menu whenever the procedure is called, to make
- // sure that the popups stay in sync with the
- // current selection mask setting.
- //
- {
- int $completeLicense = `licenseCheck -m "edit" -typ "complete"`;
- switch( $selectionGrp ) {
- //
- // Objects
- //
- case "objMarker":
- setParent -m ( $selectionGrp + "Popup" );
-
- // Delete all items in the menu, and
- // recreate them to keep the menu in sync
- // with the current selection settings
- //
- popupMenu -e -dai ( $selectionGrp + "Popup" );
-
- menuItem -l "Selection Handles"
- -cb `selectType -q -handle`
- -c "selectType -handle #1";
- menuItem -l "IK Handles"
- -cb `selectType -q -ikHandle`
- -c "selectType -ikHandle #1";
- break;
-
- case "objJoint":
- setParent -m ( $selectionGrp + "Popup" );
-
- // Delete all items in the menu, and
- // recreate them to keep the menu in sync
- // with the current selection settings
- //
- popupMenu -e -dai ( $selectionGrp + "Popup" );
-
- menuItem -l "Skeleton Joints"
- -cb `selectType -q -joint`
- -c "selectType -joint #1";
- break;
-
- case "objCurve":
- setParent -m ( $selectionGrp + "Popup" );
-
- // Delete all items in the menu, and
- // recreate them to keep the menu in sync
- // with the current selection settings
- //
- popupMenu -e -dai ( $selectionGrp + "Popup" );
-
- menuItem -l "NURBS Curves"
- -cb `selectType -q -nurbsCurve`
- -c "selectType -nurbsCurve #1";
- if( `isTrue "SurfaceUIExists"` ) {
- menuItem -l "Curves On Surface"
- -cb `selectType -q -cos`
- -c "selectType -cos #1";
- }
- if (`isTrue MayaCreatorExists` && (`licenseCheck -m "edit" -typ "complete"`)) {
- menuItem -l "Paint Effects Strokes" // For Paint Effects
- -cb `selectType -q -stroke` // For Paint Effects
- -c "selectType -stroke #1"; // For Paint Effects
- }
- break;
-
- case "objSurface":
- setParent -m ( $selectionGrp + "Popup" );
-
- // Delete all items in the menu, and
- // recreate them to keep the menu in sync
- // with the current selection settings
- //
- popupMenu -e -dai ( $selectionGrp + "Popup" );
-
- if( `isTrue "SurfaceUIExists"` ) {
- menuItem -l "NURBS Surfaces"
- -cb `selectType -q -nurbsSurface`
- -c "selectType -nurbsSurface #1";
- }
- menuItem -l "Poly Surfaces"
- -cb `selectType -q -polymesh`
- -c "selectType -polymesh #1";
- if( `isTrue "SubdivUIExists"` ) {
- menuItem -l "Subdivision Surfaces"
- -cb `selectType -q -subdiv`
- -c "selectType -subdiv #1";
- }
- menuItem -l "Planes"
- -cb `selectType -q -plane`
- -c "selectType -plane #1";
- break;
-
- case "objDeformer":
- setParent -m ( $selectionGrp + "Popup" );
-
- // Delete all items in the menu, and
- // recreate them to keep the menu in sync
- // with the current selection settings
- //
- popupMenu -e -dai ( $selectionGrp + "Popup" );
-
- menuItem -l "Lattices"
- -cb `selectType -q -lattice`
- -c "selectType -lattice #1";
- if ($completeLicense) {
- menuItem -l "Clusters"
- -cb `selectType -q -cluster`
- -c "selectType -cluster #1";
- }
- menuItem -l "Nonlinears"
- -cb `selectType -q -nonlinear`
- -c "selectType -nonlinear #1";
- if ($completeLicense) {
- menuItem -l "Sculpt Objects"
- -cb `selectType -q -sculpt`
- -c "selectType -sculpt #1";
- }
- break;
-
- case "objDynamic":
- setParent -m ( $selectionGrp + "Popup" );
-
- // Delete all items in the menu, and
- // recreate them to keep the menu in sync
- // with the current selection settings
- //
- popupMenu -e -dai ( $selectionGrp + "Popup" );
-
- if( `licenseCheck -m edit -type complete` == 1 )
- {
- menuItem -l "Particles"
- -cb `selectType -q -particleShape`
- -c "selectType -particleShape #1";
- menuItem -l "Emitters"
- -cb `selectType -q -emitter`
- -c "selectType -emitter #1";
- menuItem -l "Fields"
- -cb `selectType -q -field`
- -c "selectType -field #1";
- menuItem -l "Springs"
- -cb `selectType -q -spring`
- -c "selectType -spring #1";
- menuItem -l "Rigid Bodies"
- -cb `selectType -q -rigidBody`
- -c "selectType -rigidBody #1";
- menuItem -l "Rigid Constraints"
- -cb `selectType -q -rigidConstraint`
- -c "selectType -rigidConstraint #1";
- }
- if( fluidEditLicenseFound() )
- {
- menuItem -l "Fluids"
- -cb `selectType -q -fluid`
- -c "selectType -fluid #1";
- }
- break;
-
- case "objRendering":
- setParent -m ( $selectionGrp + "Popup" );
-
- // Delete all items in the menu, and
- // recreate them to keep the menu in sync
- // with the current selection settings
- //
- popupMenu -e -dai ( $selectionGrp + "Popup" );
-
- menuItem -l "Lights"
- -cb `selectType -q -light`
- -c "selectType -light #1";
- menuItem -l "Cameras"
- -cb `selectType -q -camera`
- -c "selectType -camera #1";
- menuItem -l "Textures"
- -cb `selectType -q -texture`
- -c "selectType -texture #1";
- break;
-
- case "objOther":
- setParent -m ( $selectionGrp + "Popup" );
-
- // Delete all items in the menu, and
- // recreate them to keep the menu in sync
- // with the current selection settings
- //
- popupMenu -e -dai ( $selectionGrp + "Popup" );
-
- menuItem -l "IK End Effectors"
- -cb `selectType -q -ikEndEffector`
- -c "selectType -ikEndEffector #1";
- menuItem -l "Locators"
- -cb `selectType -q -locator`
- -c "selectType -locator #1";
- menuItem -l "Dimensions"
- -cb `selectType -q -dimension`
- -c "selectType -dimension #1";
- break;
-
- //
- // Components
- //
- case "compPoint":
- setParent -m ( $selectionGrp + "Popup" );
-
- // Delete all items in the menu, and
- // recreate them to keep the menu in sync
- // with the current selection settings
- //
- popupMenu -e -dai ( $selectionGrp + "Popup" );
-
- menuItem -l "NURBS CVs"
- -cb `selectType -q -cv`
- -c "selectType -cv #1";
- menuItem -l "Poly Vertices"
- -cb `selectType -q -polymeshVertex`
- -c "selectType -polymeshVertex #1";
- if( `isTrue "SubdivUIExists"` ) {
- menuItem -l "Subdiv Vertices"
- -cb `selectType -q -subdivMeshPoint`
- -c "selectType -subdivMeshPoint #1";
- }
- menuItem -l "Lattice Points"
- -cb `selectType -q -latticePoint`
- -c "selectType -latticePoint #1";
- if( `licenseCheck -m edit -type complete` == 1 )
- {
- menuItem -l "Particles"
- -cb `selectType -q -particle`
- -c "selectType -particle #1";
- }
- break;
-
- case "compParmPoint":
- setParent -m ( $selectionGrp + "Popup" );
-
- // Delete all items in the menu, and
- // recreate them to keep the menu in sync
- // with the current selection settings
- //
- popupMenu -e -dai ( $selectionGrp + "Popup" );
-
- menuItem -l "NURBS Edit Points"
- -cb `selectType -q -editPoint`
- -c "selectType -editPoint #1";
- menuItem -l "NURBS Curve Points"
- -cb `selectType -q -cpp`
- -c "selectType -cpp #1";
- menuItem -l "NURBS Surface Points"
- -cb `selectType -q -spp`
- -c "selectType -spp #1";
- menuItem -l "Poly UVs"
- -cb `selectType -q -puv`
- -c "selectType -puv #1";
- if( `isTrue "SubdivUIExists"` ) {
- menuItem -l "Subdiv UVs"
- -cb `selectType -q -subdivMeshUV`
- -c "selectType -subdivMeshUV #1";
- }
- break;
-
- case "compLine":
- setParent -m ( $selectionGrp + "Popup" );
-
- // Delete all items in the menu, and
- // recreate them to keep the menu in sync
- // with the current selection settings
- //
- popupMenu -e -dai ( $selectionGrp + "Popup" );
-
- if( `isTrue "SurfaceUIExists"` ) {
- menuItem -l "NURBS Isoparms"
- -cb `selectType -q -isoparm`
- -c "selectType -isoparm #1";
- menuItem -l "NURBS Trim Edges"
- -cb `selectType -q -surfaceEdge`
- -c "selectType -surfaceEdge #1";
- }
- menuItem -l "Poly Edges"
- -cb `selectType -q -polymeshEdge`
- -c "selectType -polymeshEdge #1";
- if( `isTrue "SubdivUIExists"` ) {
- menuItem -l "Subdiv Edges"
- -cb `selectType -q -subdivMeshEdge`
- -c "selectType -subdivMeshEdge #1";
- }
- if( `licenseCheck -m edit -type complete` == 1 )
- {
- menuItem -l "Springs"
- -cb `selectType -q -springComponent`
- -c "selectType -springComponent #1";
- }
- break;
-
- case "compFacet":
- setParent -m ( $selectionGrp + "Popup" );
-
- // Delete all items in the menu, and
- // recreate them to keep the menu in sync
- // with the current selection settings
- //
- popupMenu -e -dai ( $selectionGrp + "Popup" );
-
- if( `isTrue "SurfaceUIExists"` ) {
- menuItem -l "NURBS Patches"
- -cb `selectType -q -surfaceFace`
- -c "selectType -surfaceFace #1";
- }
- menuItem -l "Poly Faces"
- -cb `selectType -q -facet`
- -c "selectType -facet #1";
- if( `isTrue "SubdivUIExists"` ) {
- menuItem -l "Subdiv Faces"
- -cb `selectType -q -subdivMeshFace`
- -c "selectType -subdivMeshFace #1";
- }
- break;
-
- case "compHull":
- setParent -m ( $selectionGrp + "Popup" );
-
- // Delete all items in the menu, and
- // recreate them to keep the menu in sync
- // with the current selection settings
- //
- popupMenu -e -dai ( $selectionGrp + "Popup" );
-
- menuItem -l "NURBS Hulls"
- -cb `selectType -q -hull`
- -c "selectType -hull #1";
- break;
-
- case "compPivot":
- setParent -m ( $selectionGrp + "Popup" );
-
- // Delete all items in the menu, and
- // recreate them to keep the menu in sync
- // with the current selection settings
- //
- popupMenu -e -dai ( $selectionGrp + "Popup" );
-
- menuItem -l "Rotate Pivots"
- -cb `selectType -q -rotatePivot`
- -c "selectType -rotatePivot #1";
- menuItem -l "Scale Pivots"
- -cb `selectType -q -scalePivot`
- -c "selectType -scalePivot #1";
- menuItem -l "Joint Pivots"
- -cb `selectType -q -jointPivot`
- -c "selectType -jointPivot #1";
- break;
-
- case "compMarker":
- setParent -m ( $selectionGrp + "Popup" );
-
- // Delete all items in the menu, and
- // recreate them to keep the menu in sync
- // with the current selection settings
- //
- popupMenu -e -dai ( $selectionGrp + "Popup" );
-
- menuItem -l "Selection Handles"
- -cb `selectType -q -selectHandle`
- -c "selectType -selectHandle #1";
-
- break;
-
- case "compOther":
- setParent -m ( $selectionGrp + "Popup" );
-
- // Delete all items in the menu, and
- // recreate them to keep the menu in sync
- // with the current selection settings
- //
- popupMenu -e -dai ( $selectionGrp + "Popup" );
-
- menuItem -l "Local Rotation Axes"
- -cb `selectType -q -localRotationAxis`
- -c "selectType -localRotationAxis #1";
- menuItem -l "Image Planes"
- -cb `selectType -q -imagePlane`
- -c "selectType -imagePlane #1";
- break;
- }
- }
-
-
-
- global proc workingMode( string $mode )
- //
- // Changes Maya into various 'working modes', like
- // all, where the user has access to all tools in
- // the tool palette, tool popups, etc, to things like
- // animation mode, where tool choices are more limited,
- // selection weighting is switched around, etc..
- //
- {
- if( `licenseCheck -m edit -type complete` == 0 )
- {
- if( $mode == "Dynamics" )
- {
- warning("You are not licensed to use the \"Dynamics\" menu set.");
- //
- // Since the default mode is "Animation" (see the switch statement
- // below), we will set the mode to be that if the user chose Dynamics
- // but is not licensed for it.
- //
- $mode = "Animation";
- }
- }
-
- global string $gMenuModeButton;
-
- // Set Maya's new 'working mode' to $mode,
- // so that ModelEdMenu can check to see if
- // it should rebuild the main menu next time
- // it's popped up.
- //
- global string $gMayaMode;
- $gMayaMode = $mode;
- //
- // Set selection priorities to match the mode
- // the user is working in.
- //
- // selPriority $mode;
- //
- // Destroy the popup called $controlName + "MainPop"
- // in order to get them to recreate themselves.
- //
- string $modelPanels[] = `getPanel -type modelPanel`;
-
- for( $item in $modelPanels )
- {
- if (`popupMenu -exists ( $item + "MainPop" )`) {
- popupMenu -e -dai ( $item + "MainPop" );
- }
- }
-
- // Update the working mode
- //
- switch( $mode ) {
- case "Animation": setMenuMode Animation; syncHotBox Animation; break;
- case "Modeling": setMenuMode Modeling; syncHotBox Modeling; break;
- case "Rendering": setMenuMode Rendering; syncHotBox Rendering; break;
- case "Dynamics": setMenuMode Dynamics; syncHotBox Dynamics; break;
- case "Cloth": setMenuMode Cloth; syncHotBox Cloth; break;
- case "Live": setMenuMode Live; syncHotBox Live; break;
- default: setMenuMode Animation; $mode = "Animation"; syncHotBox Animation; break;
- }
- }
-
- global proc updateMenuMode()
- {
- global string $gMenuModeButton;
- workingMode(`optionMenu -q -v $gMenuModeButton`);
- }
-
- global proc statusLineUpdateInputField()
- //
- // Description:
- // This procedure updates the value of the input field on the
- // Status Line.
- //
- // When the input field is in rename mode then get the name of
- // the lead object in the selection list and display it in the
- // field.
- //
- // When the input field is in any other mode then clear the
- // field value.
- //
- {
- global string $gNumericalInputField;
-
- // Determine the mode of the field. Only way to do this is
- // to figure out what image is currently applied to the field
- // label.
- //
- string $image = `iconTextButton -query -image1 statusFieldButton`;
- string $fieldValue = "";
-
- if ("quickRename.xpm" == $image) {
-
- // Update the field with the name of the lead object in the selection.
- //
- string $selectionArray[], $tokenBuffer[], $selectedObject;
- int $numberOfSelectedObjects, $tokenCount;
-
- // Determine the lead object in the selection.
- //
- $selectionArray = `ls -selection -tail 1`;
- $numberOfSelectedObjects = size($selectionArray);
- if (0 < $numberOfSelectedObjects) {
- $selectedObject = $selectionArray[$numberOfSelectedObjects - 1];
-
- // It is possible that the full path to an object may be
- // returned even when querying the selection by short names.
- // This will happen if the more than one object has the
- // same name. The full path won't fit in the rename field
- // so strip off the path and display only the short name.
- // To do this tokenize the object name by the | character.
- // The short name will be the last item in the array
- // returned by the tokenize command.
- //
- $tokenCount = `tokenize $selectedObject "|" $tokenBuffer`;
- $fieldValue = $tokenBuffer[$tokenCount - 1];
-
- } else {
- //
- // Nothing selected. Clear the field.
- //
- $fieldValue = "";
- }
-
- } else {
- //
- // For all the other field modes clear the text.
- //
- $fieldValue = "";
- }
-
- // Update the field.
- //
- textField -edit -text $fieldValue $gNumericalInputField;
- }
-
- global proc quickRename()
- //
- // Description:
- // Called from the quick rename field to allow easy renaming of
- // the selected objects for users who don't want to have to open
- // the Channel Box or Attribute Editor.
- //
- {
- global string $gNumericalInputField;
-
- string $newName;
- int $renameResult;
-
- // Get the name in the text field.
- //
- $newName = `textField -query -text $gNumericalInputField`;
-
- // The result will contain the number of renamed objects,
- // which may be zero if all the objects in the selection
- // list are read-only (examples of read-only objects are
- // default and referenced objects).
- //
- $renameResult = renameSelectionList($newName);
-
- if (0 <= $renameResult) {
- //
- // Return focus to the panel that last had focus.
- //
- setFocus `getPanel -withFocus`;
-
- } else if (-1 == $renameResult) {
- //
- // The selection list is empty. Not serious, just print
- // a warning.
- //
- warning ("There are no selected objects to rename. Select "
- + "one or more objects and re-enter a name.");
-
- statusLineUpdateInputField();
-
- // Return focus to the panel that last had focus.
- //
- setFocus `getPanel -withFocus`;
-
- } else if (-2 == $renameResult) {
- //
- // An invalid name error. Print an error message.
- // Don't send focus back to the panels. Keep it in the field
- // so the user can correct the error in the field.
- //
- error ("\"" + $newName + "\" is not a valid name. Enter a name " +
- "that begins with a letter or underscore and is followed " +
- "by letters, digits or underscores.");
- }
- }
-
- global proc quickWildcardSelect()
- //
- // Called from the quick select field to allow easy wildcard
- // selection with feedback for users who don't want to have
- // to open the outliner for simple selections.
- //
- {
- global string $gNumericalInputField;
-
- // Get the text in the select field.
- //
- string $text = `textField -query -text $gNumericalInputField`;
-
- // Are there any wildcard characters in the text?
- // Wildcard characters are * and ? (are there others?).
- //
- int $wildcards = false;
- if (`gmatch $text "*[\*\?]*"`) {
- $wildcards = true;
- }
-
- string $cmd;
-
- // If there are no wildcards then do a test to see if the
- // name specified in the field uniquely specifies a single
- // object in the scene. This can be determined by using
- // the "ls" command.
- //
- if (!$wildcards) {
- string $object, $objectArray[] = `ls $text`;
- if (1 < size($objectArray)) {
- //
- // There is more than one object with the name specified.
- // Be sure to select them all.
- //
- $cmd = "select";
- for ($object in $objectArray) {
- $cmd += (" " + $object);
- }
-
- } else {
- //
- // No wildcards and just one object with the specified
- // name.
- //
- $cmd = ("select \"" + $text + "\"");
- }
-
- } else {
- $cmd = ("select \"" + $text + "\"");
- }
-
- // If something was actually selected then give some feedback
- // and clean up. Otherwise the offending text is left in the
- // field and focus remains in the field for another try.
- //
- if (!catch(eval($cmd))) {
-
- // Give some feedback that something was selected. Query
- // what's on the selection list and for each item append
- // it to a result string that will be echoed to the user.
- //
- string $lsList = "";
- string $lsArray[] = `ls -sl`;
- for ($i = 0; $i < size($lsArray); $i++) {
- $lsList = $lsList+" "+$lsArray[$i];
- }
- print ("// Result: "+$lsList+"\n");
-
- // Clear the field and throw the focus back to the panels
- //
- statusLineUpdateInputField();
- setFocus `paneLayout -query -pane1 viewPanes`;
- }
- }
-
- global proc setQuickFieldMode (string $mode)
- {
- global string $gNumericalInputField;
- switch ($mode) {
- case "Select":
- iconTextButton -e -i1 "quickSelect.xpm" statusFieldButton;
- textField -e
- -ann "Type text with wildcards to select objects"
- -cc "quickWildcardSelect" -ec ""
- $gNumericalInputField;
- break;
-
- case "Rename":
- iconTextButton -e -i1 "quickRename.xpm" statusFieldButton;
- textField -edit
- -annotation "Rename the selected object(s)"
- -changeCommand ("quickRename") -enterCommand ("")
- $gNumericalInputField;
- break;
-
- case "Abs":
- iconTextButton -e -i1 "absolute.xpm" statusFieldButton;
- textField -e
- -ann "Absolute values used for current tool"
- -cc "numericalInputChangeCommand abs"
- -ec "setFocus $gNumericalInputField"
- $gNumericalInputField;
- break;
-
- case "Rel":
- iconTextButton -e -i1 "relative.xpm" statusFieldButton;
- textField -e
- -ann "Relative values used for current tool"
- -cc "numericalInputChangeCommand rel"
- -ec "setFocus $gNumericalInputField"
- $gNumericalInputField;
- break;
- }
-
- // When the mode changes update the field.
- //
- statusLineUpdateInputField();
- }
-
- global proc updateStatusLineRendererSpecificUI()
- {
- //
- // Description:
- // This procedure is called when the current renderer changes.
- // This procedure updates status line UI which behaves differently
- // depending on the current renderer.
- //
-
- global string $gStatusLine;
- string $currentRendererName = currentRenderer();
- string $renUIName = `renderer -query -rendererUIName $currentRendererName`;
-
-
- if (!`layout -exists $gStatusLine`) return;
-
- setParent $gStatusLine;
-
- // Change the tool tip associated with the render icon button
- // on status line in the main window.
- //
- iconTextButton
- -edit
- -annotation
- ("Render the current frame (" + $renUIName + ")")
- renderButton;
-
- // Change the tool tip associated with the render globals icon button
- // on status line in the main window.
- //
- iconTextButton
- -edit
- -annotation
- ("Display Render Globals window (" + $renUIName + ")")
- renderGlobalsButton;
-
- // Enable/disable the IPR button if it is supported/not supported by the
- // current renderer.
- //
- if (`renderer -query -iprRenderProcedure $currentRendererName` != "")
- {
- iconTextButton
- -edit
- -enable true
- -annotation
- ("IPR render the current frame (" + $renUIName + ")")
- iprRenderButton;
- }
- else
- {
- iconTextButton
- -edit
- -enable false
- -annotation ("")
- iprRenderButton;
- }
-
- setParent ..;
- }
-
- // Register the procedure responsible for updating all renderer
- // related UI created in the status line.
- //
- registerUpdateRendererUIProc("updateStatusLineRendererSpecificUI");
-
-
- //global proc string statusLine ()
- {
- global string $gStatusLine;
- global string $gStatusLineForm;
- global string $gMenuModeButton;
- global string $gNumericalInputField;
-
- int $height = 26;
-
- // New for 4.0 are buttons on the far right of the Status Line that
- // control the visibility of the Attribute Editor, Tool Settings, and
- // Channel Box / Layer Editor.
- //
- // To do this insert a form layout. The existing $gStatusLineForm will
- // be parented to it as well as the form that contains the new buttons.
- //
- $statusLine = `formLayout -parent $gStatusLineForm`;
- $gStatusLine = `formLayout`;
-
- // Create the Menubar set switching popup
- $gMenuModeButton =
- `optionMenu
- -annotation "Menu Sets: Select the menus to appear in the Main Menu Bar"
- -cc updateMenuMode menuMode`;
- menuItem -l "Animation" -enableCommandRepeat false animationMode;
- menuItem -l "Modeling" -enableCommandRepeat false modelingMode;
- if( `licenseCheck -m edit -type complete` == 1 )
- {
- menuItem -l "Dynamics" -enableCommandRepeat false dynamicsMode;
- }
- menuItem -l "Rendering" -enableCommandRepeat false renderingMode;
-
-
- //
- // set height to height of optionMenu if it is too tall
- // (this happens with LargeFonts installed on NT
- //
- int $h = `control -q -h menuMode`;
- if ($h > $height) $height = $h;
- int $iconHeight = 26;
- int $thinIconWidth = 17;
-
- // If the user has either of these turned off then dim the
- // menu item.
- if( `licenseCheck -m edit -type complete` == 1 )
- {
- if (!`isTrue "DynamicsExists"`)
- menuItem -e -en 0 dynamicsMode;
- }
-
- if (!`isTrue "RenderingExists"`)
- menuItem -e -en 0 renderingMode;
-
- setParent -m ..;
-
- // Create the New/Open/Save buttons
- iconTextButton -image1 "fileNew.xpm"
- -width ($iconHeight-4) -height $iconHeight //skinny icon
- -command ("NewScene")
- -annotation "Create a new scene"
- newSceneButton;
-
- iconTextButton -image1 "fileOpen.xpm"
- -width $iconHeight -height $iconHeight
- -command ("OpenScene")
- -annotation "Open a scene"
- openSceneButton;
-
- iconTextButton -image1 "fileSave.xpm"
- -width $iconHeight -height $iconHeight
- -command ("SaveScene")
- -annotation "Save the current scene"
- saveSceneButton;
-
- // Create the selection mask setting widget, that
- // allows user to set masks at a high level, or
- // define their own
- //
- formLayout -height $height presetForm;
- iconTextStaticLabel
- -w $thinIconWidth -h $iconHeight
- -ann "Set the selection mask"
- -i1 "popupMenuIcon.xpm"
- maskMenuIcon;
- textField
- -annotation "Selection Mode Field: Set the selection mask"
- -ed false
- -tx "Root"
- -width 94
- maskField;
- setParent ..;
-
- // Layout the above form
- //
- formLayout -e
- -af maskMenuIcon left 0
- -an maskMenuIcon right
- -af maskMenuIcon bottom 0
- -af maskMenuIcon top 0
-
- -af maskField top 0
- -ac maskField left 0 maskMenuIcon
- -af maskField bottom 0
- -an maskField right
- presetForm;
-
- // Attach a popup menu that controls the
- // contents of the textField, and sets the
- // selection masks
- //
- string $menu = `popupMenu -b 1 -p presetForm`;
- menu -e -pmc ( "buildMaskSettingMenu " + $menu ) $menu;
- setParent -m ..;
-
- // Create the icons to specify the selection mode
- //
- int $isHierarchy = `selectMode -q -hierarchical`;
- int $isObject = `selectMode -q -object`;
- int $isComponent = `selectMode -q -component`;
- int $isPreset = `selectMode -q -preset`;
-
- formLayout -manage 1 masksForm;
- iconTextCheckBox -i1 "pickHierarchy.xpm"
- -w $iconHeight -h $iconHeight
- -v ( $isHierarchy || $isPreset )
- -cc "changeSelectMode -hierarchical"
- -ann "Select by hierarchy and combinations"
- selectButton1;
- iconTextCheckBox -i1 "pickObjByType.xpm"
- -w $iconHeight -h $iconHeight
- -v $isObject
- -cc "changeSelectMode -object"
- -ann "Select by object type"
- selectButton2;
- iconTextCheckBox -i1 "pickCompByType.xpm"
- -w $iconHeight -h $iconHeight
- -v $isComponent
- -cc "changeSelectMode -component"
- -ann "Select by component type"
- selectButton3;
- setParent ..;
-
- // Layout the icons, by attaching them to themselves
- // and the formLayout holding the icons
- //
- formLayout -e
- -af selectButton3 right 0
- -ac selectButton2 right 0 selectButton3
- -ac selectButton1 right 0 selectButton2
- masksForm;
-
- formLayout selectMaskForm;
-
- // Create a separator that forces the size of the mask
- // button to always be the same.
- separator -w 230 -height 1 -style none selectMaskSeparator;
-
- // Create the label that says the user is in a combo
- // mode
- text -l "Combination Selection" -manage $isPreset comboSelectText;
-
- // Create the label that says the user is in a combo
- // mode
- // text -l "Hierarchical Selection" -manage $isHierarchy hierSelectText;
-
- // Create the icons to specify the hierarchy mode pick mask
- //
- formLayout -manage $isHierarchy hierarchyIcons;
-
- formLayout hierPickMenuLayout;
- iconTextStaticLabel
- -w $thinIconWidth -h $iconHeight
- -annotation "Set the hierarchy selection mask"
- -i1 "popupMenuIcon.xpm"
- hierPickMenuIcon;
- setParent ..;
-
- iconTextCheckBox -i1 "selectObj.xpm" -v 1
- -w $iconHeight -h $iconHeight
- -cc "setHierSelectMode -root"
- -ann "Select by hierarchy: Root"
- hierRootButton;
- iconTextCheckBox -i1 "selectComp.xpm" -v 0
- -w $iconHeight -h $iconHeight
- -cc "setHierSelectMode -leaf"
- -ann "Select by hierarchy: Leaf"
- hierLeafButton;
- iconTextCheckBox -i1 "pickTemplate.xpm" -v 0
- -w $iconHeight -h $iconHeight
- -cc "setHierSelectMode -template"
- -ann "Select by hierarchy: Template"
- hierTemplateButton;
- // iconTextCheckBox -i1 "pickCurveObj.xpm" -v 0
- // -w $iconHeight -h $iconHeight
- // -cc "setHierSelectMode -preset"
- // -ann "Select by combination: Modeling"
- // comboModelingButton;
- setParent ..;
-
- // Layout the icons, by attaching them to themselves
- // and the formLayout holding the icons
- //
- formLayout -e
- -af hierPickMenuLayout left 0
- -ac hierRootButton left 3 hierPickMenuLayout
- -ac hierLeafButton left 0 hierRootButton
- -ac hierTemplateButton left 0 hierLeafButton
- hierarchyIcons;
-
- // Attach a menu to the hierPickMenuLayout
- //
- popupMenu -b 1 -p hierPickMenuLayout;
- menuItem -l "Root"
- -c "selectMode -root"
- rootPickMenuItem;
- menuItem -l "Leaf"
- -c "selectMode -leaf"
- leafPickMenuItem;
- menuItem -l "Template"
- -c "selectMode -template"
- templatePickMenuItem;
- // menuItem -l "Template"
- // -c "setHierSelectMode -comboModeling"
- // comboModelingPickMenuItem;
- setParent -m ..;
-
- // Create the icons to specify the object mode pick mask
- // in a coarser manner than the pick mask menus.
- //
- formLayout -manage $isObject objectMaskIcons;
-
- formLayout objPickMenuLayout;
- iconTextStaticLabel
- -w $thinIconWidth -h $iconHeight
- -annotation "Set the object selection mask"
- -i1 "popupMenuIcon.xpm"
- objPickMenuIcon;
- setParent ..;
-
- iconTextCheckBox -i1 "pickHandlesObj.xpm" -v 1
- -w $iconHeight -h $iconHeight
- -ann "Select by object type: Handles (RMB for more info)"
- -cc "setObjectPickMask \"Marker\" #1" objButton1;
- iconTextCheckBox -i1 "pickJointObj.xpm" -v 1
- -w $iconHeight -h $iconHeight
- -ann "Select by object type: Joints (RMB for more info)"
- -cc "setObjectPickMask \"Joint\" #1" objButton2;
- iconTextCheckBox -i1 "pickCurveObj.xpm" -v 1
- -w $iconHeight -h $iconHeight
- -ann "Select by object type: Curves (RMB for more info)"
- -cc "setObjectPickMask \"Curve\" #1" objButton3;
- iconTextCheckBox -i1 "pickGeometryObj.xpm" -v 1
- -w $iconHeight -h $iconHeight
- -ann "Select by object type: Surfaces (RMB for more info)"
- -cc "setObjectPickMask \"Surface\" #1" objButton4;
- iconTextCheckBox -i1 "pickDeformerObj.xpm" -v 1
- -w $iconHeight -h $iconHeight
- -ann "Select by object type: Deformations (RMB for more info)"
- -cc "setObjectPickMask \"Deformer\" #1" objButton5;
- iconTextCheckBox -i1 "pickDynamicsObj.xpm" -v 1
- -w $iconHeight -h $iconHeight
- -ann "Select by object type: Dynamics (RMB for more info)"
- -cc "setObjectPickMask \"Dynamic\" #1" objButton6;
- iconTextCheckBox -i1 "pickRenderingObj.xpm" -v 1
- -w $iconHeight -h $iconHeight
- -ann "Select by object type: Rendering (RMB for more info)"
- -cc "setObjectPickMask \"Rendering\" #1" objButton7;
- iconTextCheckBox -i1 "pickOtherObj.xpm" -v 1
- -w $iconHeight -h $iconHeight
- -ann "Select by object type: Miscellaneous (RMB for more info)"
- -cc "setObjectPickMask \"Other\" #1" objButton8;
- setParent ..;
-
- popupMenu -b 3 -p objButton1
- -pmc "createMaskPopup \"objMarker\""
- objMarkerPopup;
- popupMenu -b 3 -p objButton2
- -pmc "createMaskPopup \"objJoint\""
- objJointPopup;
- popupMenu -b 3 -p objButton3
- -pmc "createMaskPopup \"objCurve\""
- objCurvePopup;
- popupMenu -b 3 -p objButton4
- -pmc "createMaskPopup \"objSurface\""
- objSurfacePopup;
- popupMenu -b 3 -p objButton5
- -pmc "createMaskPopup \"objDeformer\""
- objDeformerPopup;
- popupMenu -b 3 -p objButton6
- -pmc "createMaskPopup \"objDynamic\""
- objDynamicPopup;
- popupMenu -b 3 -p objButton7
- -pmc "createMaskPopup \"objRendering\""
- objRenderingPopup;
- popupMenu -b 3 -p objButton8
- -pmc "createMaskPopup \"objOther\""
- objOtherPopup;
-
- // Layout the icons, by attaching them to themselves
- // and the formLayout holding the icons
- //
- formLayout -e
-
- -af objButton8 top 0
- -an objButton8 left
- -af objButton8 bottom 0
- -af objButton8 right 0
-
- -af objButton7 top 0
- -an objButton7 left
- -af objButton7 bottom 0
- -ac objButton7 right 0 objButton8
-
- -af objButton6 top 0
- -an objButton6 left
- -af objButton6 bottom 0
- -ac objButton6 right 0 objButton7
-
- -af objButton5 top 0
- -an objButton5 left
- -af objButton5 bottom 0
- -ac objButton5 right 0 objButton6
-
- -af objButton4 top 0
- -an objButton4 left
- -af objButton4 bottom 0
- -ac objButton4 right 0 objButton5
-
- -af objButton3 top 0
- -an objButton3 left
- -af objButton3 bottom 0
- -ac objButton3 right 0 objButton4
-
- -af objButton2 top 0
- -an objButton2 left
- -af objButton2 bottom 0
- -ac objButton2 right 0 objButton3
-
- -af objButton1 top 0
- -an objButton1 left
- -af objButton1 bottom 0
- -ac objButton1 right 0 objButton2
-
- -af objPickMenuLayout top 0
- -an objPickMenuLayout left
- -an objPickMenuLayout bottom
- -ac objPickMenuLayout right 3 objButton1
-
- objectMaskIcons;
-
- // Create the icons to specify the component mode pick mask
- // in a coarser manner than the pick mask menus.
- //
- formLayout -manage $isComponent componentMaskIcons;
-
- formLayout compPickMenuLayout;
- iconTextStaticLabel
- -w $thinIconWidth -h $iconHeight
- -annotation "Set the component selection mask"
- -i1 "popupMenuIcon.xpm"
- compPickMenuIcon;
- setParent ..;
-
- iconTextCheckBox -i1 "pickPointComp2.xpm" -v 0
- -w $iconHeight -h $iconHeight
- -ann "Select by component type: Points (RMB for more info)"
- -cc "setComponentPickMask \"Point\" #1" compButton1;
- iconTextCheckBox -i1 "pickPointComp.xpm" -v 0
- -w $iconHeight -h $iconHeight
- -ann "Select by component type: Parm Points (RMB for more info)"
- -cc "setComponentPickMask \"ParmPoint\" #1" compButton2;
- iconTextCheckBox -i1 "pickLineComp.xpm" -v 0
- -w $iconHeight -h $iconHeight
- -ann "Select by component type: Lines (RMB for more info)"
- -cc "setComponentPickMask \"Line\" #1" compButton3;
- iconTextCheckBox -i1 "pickFacetComp.xpm" -v 0
- -w $iconHeight -h $iconHeight
- -ann "Select by component type: Faces (RMB for more info)"
- -cc "setComponentPickMask \"Facet\" #1" compButton4;
- iconTextCheckBox -i1 "pickHullComp.xpm" -v 0
- -w $iconHeight -h $iconHeight
- -ann "Select by component type: Hulls (RMB for more info)"
- -cc "setComponentPickMask \"Hull\" #1" compButton5;
- iconTextCheckBox -i1 "pickPivotComp.xpm" -v 0
- -w $iconHeight -h $iconHeight
- -ann "Select by component type: Pivots (RMB for more info)"
- -cc "setComponentPickMask \"Pivot\" #1" compButton6;
- iconTextCheckBox -i1 "pickHandlesComp.xpm" -v 0
- -w $iconHeight -h $iconHeight
- -ann "Select by component type: Handles (RMB for more info)"
- -cc "setComponentPickMask \"Marker\" #1" compButton7;
- iconTextCheckBox -i1 "pickOtherComp.xpm" -v 0
- -w $iconHeight -h $iconHeight
- -ann "Select by component type: Miscellaneous (RMB for more info)"
- -cc "setComponentPickMask \"Other\" #1" compButton8;
- setParent ..;
-
- popupMenu -b 3 -p compButton1
- -pmc "createMaskPopup \"compPoint\""
- compPointPopup;
- popupMenu -b 3 -p compButton2
- -pmc "createMaskPopup \"compParmPoint\""
- compParmPointPopup;
- popupMenu -b 3 -p compButton3
- -pmc "createMaskPopup \"compLine\""
- compLinePopup;
- popupMenu -b 3 -p compButton4
- -pmc "createMaskPopup \"compFacet\""
- compFacetPopup;
- popupMenu -b 3 -p compButton5
- -pmc "createMaskPopup \"compHull\""
- compHullPopup;
- popupMenu -b 3 -p compButton6
- -pmc "createMaskPopup \"compPivot\""
- compPivotPopup;
- popupMenu -b 3 -p compButton7
- -pmc "createMaskPopup \"compMarker\""
- compMarkerPopup;
- popupMenu -b 3 -p compButton8
- -pmc "createMaskPopup \"compOther\""
- compOtherPopup;
-
- // Layout the icons, by attaching them to themselves
- // and the formLayout holding the icons
- //
- formLayout -e
-
- -af compButton8 right 0
- -ac compButton7 right 0 compButton8
- -ac compButton6 right 0 compButton7
- -ac compButton5 right 0 compButton6
- -ac compButton4 right 0 compButton5
- -ac compButton3 right 0 compButton4
- -ac compButton2 right 0 compButton3
- -ac compButton1 right 0 compButton2
- -ac compPickMenuLayout right 2 compButton1
-
- componentMaskIcons;
-
- setParent ..;
-
- formLayout -edit
- -an selectMaskSeparator top
- -af selectMaskSeparator left 0
- -af selectMaskSeparator bottom 0
- -af selectMaskSeparator right 0
-
- -af comboSelectText top 0
- -af comboSelectText left 0
- -ac comboSelectText bottom 0 selectMaskSeparator
- -an comboSelectText right
-
- -af hierarchyIcons top 0
- -af hierarchyIcons left 0
- -ac hierarchyIcons bottom 0 selectMaskSeparator
- -an hierarchyIcons right
-
- -af objectMaskIcons top 0
- -af objectMaskIcons left 0
- -ac objectMaskIcons bottom 0 selectMaskSeparator
- -an objectMaskIcons right
-
- -af componentMaskIcons top 0
- -af componentMaskIcons left 0
- -ac componentMaskIcons bottom 0 selectMaskSeparator
- -an componentMaskIcons right
-
- selectMaskForm;
-
- // Create the icons to specify the snapping
- //
- formLayout -vis 1 snapIcons;
- iconTextCheckBox
- -i1 "snapCurve.xpm"
- -w $iconHeight -h $iconHeight
- -v 0
- -cc "snapMode -curve #1"
- -ann "Snap to curves"
- snapButton1;
- iconTextCheckBox
- -i1 "snapPoint.xpm"
- -w $iconHeight -h $iconHeight
- -v 0
- -cc "snapMode -point #1"
- -ann "Snap to points"
- snapButton3;
- iconTextCheckBox
- -i1 "snapGrid.xpm"
- -w $iconHeight -h $iconHeight
- -v 0
- -cc "snapMode -grid #1"
- -ann "Snap to grids"
- snapButton4;
- iconTextCheckBox
- -i1 "snapPlane.xpm"
- -w $iconHeight -h $iconHeight
- -v 0
- -cc "snapMode -viewPlane #1"
- -ann "Snap to view planes"
- snapButton6;
- //
- // Create a "make live" button
- //
- iconTextButton
- -image1 "makeLiveIcon.xpm"
- -width $height -height $height
- -command ("MakeLive")
- -annotation "Make the selected object live"
- makeLiveButton;
- setParent ..;
-
- // Layout the icons, by attaching them to themselves
- // and the formLayout holding the icons
- //
- formLayout -e
- // -af snapButton7 right 0
- -af makeLiveButton right 0
- -ac snapButton6 right 0 makeLiveButton
- // -ac snapButton5 right 0 snapButton6
- // -ac snapButton4 right 0 snapButton5
- // -ac snapButton2 right 0 snapButton6
- -ac snapButton3 right 0 snapButton6
- -ac snapButton1 right 0 snapButton3
- -ac snapButton4 right 0 snapButton1
- snapIcons;
-
- // Create the history button and popup
- //
- formLayout historyLayout;
-
- // Place both of the symbol buttons in a form layout so that
- // the popup menu can be attached to the form instead of the
- // button. This will prevent the button from looking like it's
- // still pressed after the popup menu is accessed.
- //
- string $historyForm = `formLayout`;
- iconTextButton
- -w $iconHeight -h $iconHeight
- -annotation "Inputs to the selected object"
- -i1 "historyPulldownIcon.xpm" historyIcon;
- setParent ..;
- string $futureForm = `formLayout`;
- iconTextButton
- -w $iconHeight -h $iconHeight
- -annotation "Outputs from the selected object"
- -i1 "futurePulldownIcon.xpm" futureIcon;
- setParent ..;
- iconTextCheckBox -i1 "constructionHistoryOn.xpm" -v 0
- -w $iconHeight -h $iconHeight
- -ann "Construction History On/Off"
- -cc "constructionHistory -toggle #1"
- constructionHistoryButton;
- updateConstructionHistory;
- setParent ..;
-
- formLayout -e
- -af $historyForm left 0
- -af $historyForm top 0
- -af $historyForm bottom 0
-
- -ac $futureForm left 0 $historyForm
- -af $futureForm top 0
- -af $futureForm bottom 0
-
- -ac constructionHistoryButton left 0 $futureForm
- -af constructionHistoryButton top 0
-
- historyLayout;
-
- popupMenu -b 1 -p $historyForm -pmc "createHistoryPopup"
- -aob true historyPopup;
- popupMenu -b 1 -p $futureForm -pmc "createFuturePopup"
- -aob true futurePopup;
-
- //
- // Create the rendering icons
- //
- iconTextButton
- -image1 "rvRender.xpm"
- -width $iconHeight -height $iconHeight
- -command ("RenderIntoNewWindow")
- -annotation "Render the current frame"
- renderButton;
-
- iconTextButton
- -image1 "rvIprRender.xpm"
- -width $iconHeight -height $iconHeight
- -command ("IPRRenderIntoNewWindow")
- -annotation "IPR render the current frame"
- iprRenderButton;
-
- iconTextButton
- -image1 "rvRenderGlobals.xpm"
- -width $iconHeight -height $iconHeight
- -command ("displayRenderGlobalsWindow")
- -annotation "Display Render Globals window"
- renderGlobalsButton;
-
- //
- // Create the selection field
- //
- iconTextButton
- -i1 "quickSelect.xpm"
- -w 30 -h $iconHeight
- -annotation "Set the field entry mode"
- statusFieldButton;
-
- $gNumericalInputField = `textField -w 84
- -ann "Type text with wildcards to select objects"
- -cc "quickWildcardSelect"`;
-
- // Attach script jobs to the input field to catch object rename
- // and selection change events.
- //
- scriptJob -parent $gNumericalInputField
- -event "SelectionChanged" ("statusLineUpdateInputField");
- scriptJob -parent $gNumericalInputField
- -event "NameChanged" ("statusLineUpdateInputField");
-
- // Put a menu on the button to change modes
- string $menu = `popupMenu -b 1 -p statusFieldButton`;
- menuItem -l "Quick Selection" -c "setQuickFieldMode Select";
- menuItem -l "Quick Rename" -c "setQuickFieldMode Rename";
- menuItem -l "Numeric Input: Absolute" -c "setQuickFieldMode Abs";
- menuItem -l "Numeric Input: Relative" -c "setQuickFieldMode Rel";
- setParent -m ..;
-
- // Put the same menu on the field as a shortcut
- string $menu = `popupMenu -b 3 -p $gNumericalInputField`;
- menuItem -l "Quick Selection" -c "setQuickFieldMode Select";
- menuItem -l "Quick Rename" -c "setQuickFieldMode Rename";
- menuItem -l "Numeric Input: Absolute" -c "setQuickFieldMode Abs";
- menuItem -l "Numeric Input: Relative" -c "setQuickFieldMode Rel";
- setParent -m ..;
-
- // Lock selection button icon
- //
- iconTextCheckBox -v 0
- -enable true
- -i1 "lock.xpm"
- -w $iconHeight -h $iconHeight
- -ann "Lock/unlock current selection"
- -cc "updateLockSelectionIcon"
- lockSelectionIcon;
-
- iconTextCheckBox -v 0
- -enable true
- // -i1 "highlightSelectOn.xpm"
- -w $iconHeight -h $iconHeight
- // -ann "Toggle Highlight Select mode"
- -cc "toggleHighlightSelectIcon"
- highlightSelectIcon;
-
- // Create the expand/collapse button separators
- //
- if (!`optionVar -exists "showStatusFiles"`) {
- optionVar -intValue "showStatusFiles" 1;
- }
- iconTextButton -vis true -h 27 -w 9
- -ann "Show/hide the file icons"
- -i1 openBar.xpm
- -c ("toggleFileIcons(-1)")
- fileCollapse;
-
- // Default this one off since it is infrequently used
- if (!`optionVar -exists "showStatusSelectionSet"`) {
- optionVar -intValue "showStatusSelectionSet" 0;
- }
- iconTextButton -vis true -h 27 -w 9
- -ann "Show/hide the selection set icons"
- -i1 openBar.xpm -c ("toggleSelectionSetIcons(-1)")
- selectionSetCollapse;
-
- if (!`optionVar -exists "showStatusSelectMode"`) {
- optionVar -intValue "showStatusSelectMode" 1;
- }
- iconTextButton -vis true -h 27 -w 9
- -ann "Show/hide the selection mode icons"
- -i1 openBar.xpm -c ("toggleSelectModeIcons(-1)")
- selectModeCollapse;
-
- if (!`optionVar -exists "showStatusSelectMasks"`) {
- optionVar -intValue "showStatusSelectMasks" 1;
- }
- iconTextButton -vis true -h 27 -w 9
- -ann "Show/hide the selection mask icons"
- -i1 openBar.xpm -c ("toggleSelectMaskIcons(-1)")
- selectMasksCollapse;
-
- if (!`optionVar -exists "showStatusSnap"`) {
- optionVar -intValue "showStatusSnap" 1;
- }
- iconTextButton -vis true -h 27 -w 9
- -ann "Show/hide the snap icons"
- -i1 openBar.xpm -c ("toggleSnapIcons(-1)")
- snapCollapse;
-
- if (!`optionVar -exists "showStatusHistory"`) {
- optionVar -intValue "showStatusHistory" 1;
- }
- iconTextButton -vis true -h 27 -w 9
- -ann "Show/hide the history icons"
- -i1 openBar.xpm -c ("toggleHistoryIcons(-1)")
- historyCollapse;
-
- if (!`optionVar -exists "showStatusRender"`) {
- optionVar -intValue "showStatusRender" 1;
- }
- iconTextButton -vis true -h 27 -w 9
- -ann "Show/hide the rendering icons"
- -i1 openBar.xpm -c ("toggleRenderIcons(-1)")
- renderCollapse;
-
- if (!`optionVar -exists "showStatusInputField"`) {
- optionVar -intValue "showStatusInputField" 1;
- }
- iconTextButton -vis true -h 27 -w 9
- -ann "Show/hide the select field"
- -i1 openBar.xpm -c ("toggleInputField(-1)")
- inputFieldCollapse;
-
- // Set up the overall formLayout that controls the
- // layout of the various parts of the infoBar
- //
- int $edging = 2;
- int $margin = 1;
-
- // Fix up the spacing before the Menu Mode option menu. Borders around
- // option menus are different across platforms. Add a couple pixels
- // to NT to make the Status Line align better with the Shelf below it.
- //
- int $menuModeSpace = 0;
- if (`about -nt`) {
- $menuModeSpace = 2;
- }
-
- formLayout -edit
- -attachForm menuMode top $margin
- -attachForm menuMode left $menuModeSpace
- -attachNone menuMode bottom
- -attachNone menuMode right
-
- -attachForm fileCollapse top $margin
- -attachControl fileCollapse left $edging menuMode
- -attachNone fileCollapse bottom
- -attachNone fileCollapse right
-
- -attachForm newSceneButton top $margin
- -attachControl newSceneButton left $edging fileCollapse
- -attachNone newSceneButton bottom
- -attachNone newSceneButton right
-
- -attachForm openSceneButton top $margin
- -attachControl openSceneButton left $edging newSceneButton
- -attachNone openSceneButton bottom
- -attachNone openSceneButton right
-
- -attachForm saveSceneButton top $margin
- -attachControl saveSceneButton left $edging openSceneButton
- -attachNone saveSceneButton bottom
- -attachNone saveSceneButton right
-
- -attachForm selectionSetCollapse top $margin
- -attachControl selectionSetCollapse left $edging saveSceneButton
- -attachNone selectionSetCollapse bottom
- -attachNone selectionSetCollapse right
-
- -attachForm presetForm top $margin
- -attachControl presetForm left $edging selectionSetCollapse
- -attachNone presetForm bottom
- -attachNone presetForm right
-
- -attachForm selectModeCollapse top $margin
- -attachControl selectModeCollapse left $edging presetForm
- -attachNone selectModeCollapse bottom
- -attachNone selectModeCollapse right
-
- -attachForm masksForm top $margin
- -attachControl masksForm left $edging selectModeCollapse
- -attachNone masksForm bottom
- -attachNone masksForm right
-
- -attachForm selectMasksCollapse top $margin
- -attachControl selectMasksCollapse left $edging masksForm
- -attachNone selectMasksCollapse bottom
- -attachNone selectMasksCollapse right
-
- -attachForm selectMaskForm top $margin
- -attachControl selectMaskForm left $edging selectMasksCollapse
- -attachNone selectMaskForm bottom
- -attachNone selectMaskForm right
-
- -attachForm lockSelectionIcon top $margin
- -attachControl lockSelectionIcon left 0 selectMaskForm
- -attachNone lockSelectionIcon bottom
- -attachNone lockSelectionIcon right
-
- -attachForm highlightSelectIcon top $margin
- -attachControl highlightSelectIcon left 0 lockSelectionIcon
- -attachNone highlightSelectIcon bottom
- -attachNone highlightSelectIcon right
-
- -attachForm snapCollapse top $margin
- -attachControl snapCollapse left $edging highlightSelectIcon
- -attachNone snapCollapse bottom
- -attachNone snapCollapse right
-
- -attachForm snapIcons top $margin
- -attachControl snapIcons left $edging snapCollapse
- -attachNone snapIcons bottom
- -attachNone snapIcons right
-
- -attachForm historyCollapse top $margin
- -attachControl historyCollapse left $edging snapIcons
- -attachNone historyCollapse bottom
- -attachNone historyCollapse right
-
- -attachForm historyLayout top $margin
- -attachControl historyLayout left $edging historyCollapse
- -attachNone historyLayout bottom
- -attachNone historyLayout right
-
- -attachForm renderCollapse top $margin
- -attachControl renderCollapse left $edging historyLayout
- -attachNone renderCollapse bottom
- -attachNone renderCollapse right
-
- -attachForm renderButton top $margin
- -attachControl renderButton left $edging renderCollapse
- -attachNone renderButton bottom
- -attachNone renderButton right
-
- -attachForm iprRenderButton top $margin
- -attachControl iprRenderButton left $edging renderButton
- -attachNone iprRenderButton bottom
- -attachNone iprRenderButton right
-
- -attachForm renderGlobalsButton top $margin
- -attachControl renderGlobalsButton left $edging iprRenderButton
- -attachNone renderGlobalsButton bottom
- -attachNone renderGlobalsButton right
-
- -attachForm inputFieldCollapse top $margin
- -attachControl inputFieldCollapse left $edging renderGlobalsButton
- -attachNone inputFieldCollapse bottom
- -attachNone inputFieldCollapse right
-
- -attachForm statusFieldButton top $margin
- -attachControl statusFieldButton left $edging inputFieldCollapse
- -attachNone statusFieldButton bottom
- -attachNone statusFieldButton right
-
- -attachForm $gNumericalInputField top $margin
- -attachControl $gNumericalInputField left $edging statusFieldButton
- -attachForm $gNumericalInputField bottom 0
- -attachNone $gNumericalInputField right
- $gStatusLine;
-
- // Create the visibility buttons for the Attribute Editor,
- // Tool Settings, and Channel Box / Layer Editor.
- //
- setParent $statusLine;
- $buttonForm = `formLayout`;
-
- // Now the buttons.
- //
- $attributeEditorButton = `iconTextButton -image1 "attributes.xpm"
- -width $iconHeight -height $iconHeight
- -annotation ("Show or hide the Attribute Editor")
- -command ("ToggleAttributeEditor")`;
-
- $toolSettingsButton = `iconTextButton -image1 "toolSettings.xpm"
- -width $iconHeight -height $iconHeight
- -annotation ("Show or hide the Tool Settings")
- -command ("ToggleToolSettings")`;
-
- $channelBoxLayerEditorButton = `iconTextButton -image1 "channelsLayers.xpm"
- -width $iconHeight -height $iconHeight
- -annotation ("Show or hide the Channel Box / Layer Editor")
- -command ("ToggleChannelsLayers")`;
-
- // Set up the attachments.
- //
- formLayout -edit
- -attachForm $attributeEditorButton top $margin
- -attachForm $attributeEditorButton left 0
- -attachNone $attributeEditorButton bottom
- -attachNone $attributeEditorButton right
-
- -attachForm $toolSettingsButton top $margin
- -attachControl $toolSettingsButton left 0 $attributeEditorButton
- -attachNone $toolSettingsButton bottom
- -attachNone $toolSettingsButton right
-
- -attachForm $channelBoxLayerEditorButton top $margin
- -attachControl $channelBoxLayerEditorButton left 0 $toolSettingsButton
- -attachNone $channelBoxLayerEditorButton bottom
- -attachNone $channelBoxLayerEditorButton right
- $buttonForm;
-
- // Attachemnts for the Status Line and the new visibility buttons.
- //
- // Note that the layout is set up this way so that the buttons
- // will always be visible even if the main Maya window is not
- // wide enough to show all the original Status Line controls.
- //
- formLayout -edit
- -attachForm $gStatusLine top 0
- -attachForm $gStatusLine left 0
- -attachForm $gStatusLine bottom 0
- -attachControl $gStatusLine right 0 $buttonForm
-
- -attachForm $buttonForm top 0
- -attachNone $buttonForm left
- -attachForm $buttonForm bottom 0
- -attachForm $buttonForm right 0
- $statusLine;
-
- toggleFileIcons(`optionVar -q showStatusFiles`);
- toggleSelectionSetIcons(`optionVar -q showStatusSelectionSet`);
- toggleSelectModeIcons(`optionVar -q showStatusSelectMode`);
- toggleSelectMaskIcons(`optionVar -q showStatusSelectMasks`);
- toggleSnapIcons(`optionVar -q showStatusSnap`);
- toggleHistoryIcons(`optionVar -q showStatusHistory`);
- toggleRenderIcons(`optionVar -q showStatusRender`);
- toggleInputField(`optionVar -q showStatusInputField`);
-
- // Add popupMenus to the infoBar layout
- //
- ObjectMaskPopup objPickMenuLayout;
- ComponentMaskPopup compPickMenuLayout;
-
- // Setup conditions to run when the selection mask
- // changes, to keep the icons on the toolbar in sync
- // with the current selection mask settings.
- //
- scriptJob -permanent -parent $gStatusLine -event "SelectModeChanged"
- updateSelectionModeIcons;
- scriptJob -permanent -parent $gStatusLine -event "SelectTypeChanged"
- updateObjectSelectionMasks;
- scriptJob -permanent -parent $gStatusLine -event "SelectTypeChanged"
- updateComponentSelectionMasks;
- scriptJob -permanent -parent $gStatusLine -event "snapModeChanged"
- updateSnapMasks;
- scriptJob -permanent -parent $gStatusLine -event "constructionHistoryChanged"
- updateConstructionHistory;
- scriptJob -permanent -parent $gStatusLine -event "SelectPreferenceChanged"
- "iconTextCheckBox -e -v `selectPref -q -xformNoSelect` lockSelectionIcon";
- scriptJob -permanent -parent $gStatusLine -event "SelectPreferenceChanged"
- "updateHighlightSelectIcon";
-
- // Run the above events now, to ensure that the icons
- // are in sync upon Maya's startup
- //
- updateObjectSelectionMasks;
- updateComponentSelectionMasks;
- updateSnapMasks;
- updateHighlightSelectIcon;
-
- // Attach Status line to parent.
- //
- formLayout -edit
- -attachForm $statusLine "top" 0
- -attachForm $statusLine "left" 0
- -attachForm $statusLine "bottom" 0
- -attachForm $statusLine "right" 0
- $gStatusLineForm;
-
- setUIComponentStateCallback(
- "Status Line", "statusLineVisibilityStateChange");
-
- updateStatusLineRendererSpecificUI();
- }
-
- global proc int statusLineVisibilityStateChange(
- int $newState,
- string $layout)
- //
- // Description:
- // This procedure is called whenever the visibility state of the
- // Status Line is changed.
- //
- // Arguments:
- // newState - The new visibile state of the Status Line.
- //
- // layout - The parent layout for the Status Line.
- //
- // Returns:
- // true - If the change of state is to be allowed.
- //
- // false - If the state change is rejected.
- //
- {
- int $result = true;
-
- // Defer these commands because this proc is called when the visibility
- // state is about to change. This proc must return true to accept
- // the state change. After this proc returns then restore the
- // panel focus and update the pref menu.
- //
- evalDeferred("restoreLastPanelWithFocus(); updatePrefsMenu();");
-
- return $result;
- }
-